Sample Notebook

This Jupyter Notebook is intended to be an example with some references. Jupyter uses Markdown Syntax and accept LaTeX and HTML codes.

With this, one can easily write bold or italic words. One can also type some code inline or code block like bellow:

import numpy
x = numpy.arange(10)
print x

One can write formulas using LaTeX syntax like $\cos \left( x \right) = \frac{X}{Y}$ or create numerated lists like:

  1. Item 1
  2. Item 2
  3. Item 3

Or unordered lists:

  • Item 1
  • Item 2
  • Item 3

This is a title in HTML

So you can edit your notebook by using HTML syntax also if you want.


Of course, you can run Python Codes too.


In [1]:
import numpy
x = numpy.arange(0, 100, 0.1)
y = numpy.cos(x)

There is a bug on MatPlotLib that does not allow it to run with Jupyter and some backends. When one tries to do some plot, the following error may appear:


In [2]:
import matplotlib.pyplot as plt
plt.plot(x, y)


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-b94941e7b4d8> in <module>()
----> 1 import matplotlib.pyplot as plt
      2 plt.plot(x, y)

/Users/Bruno/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
    112 
    113 from matplotlib.backends import pylab_setup
--> 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
    115 
    116 _IP_REGISTERED = None

/Users/Bruno/anaconda/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in pylab_setup()
     30     # imports. 0 means only perform absolute imports.
     31     backend_mod = __import__(backend_name,
---> 32                              globals(),locals(),[backend_name],0)
     33 
     34     # Things we pull in from all backends

/Users/Bruno/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py in <module>()
     22 
     23 import matplotlib
---> 24 from matplotlib.backends import _macosx
     25 
     26 

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ

If something like that happens to you, simply add %matplotlib inline before importing it.


In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(x, y)


Out[2]:
[<matplotlib.lines.Line2D at 0x1055859d0>]

In [ ]: